#include "stdafx.h"

#include "MainStatusBar.h"
#include "AllLookFeel.h"

MainStatusBar * MainStatusBar::msInstance = NULL;

MainStatusBar::MainStatusBar()
{
	msInstance = this;

	mLayout = new MGUI_Layout(AllLookFeel::Instance()->GetPanel());
	mLabel_Text = new MGUI_Label(NULL, mLayout);
	mLabel_Text->SetAlign(MGUI_Align::Stretch);
}

MainStatusBar::~MainStatusBar()
{
	delete mLayout;
	msInstance = NULL;
}

void MainStatusBar::Layout()
{
	MGUI_Rect rect;

	rect.x0 = 0;
	rect.y0 = MGUI_Engine::Instance()->GetRect().y1 - 32;
	rect.x1 = MGUI_Engine::Instance()->GetRect().x1;
	rect.y1 = MGUI_Engine::Instance()->GetRect().y1;

	mLayout->SetRect(rect);
}

void MainStatusBar::SetText(const TString128 & text)
{
	mLabel_Text->SetCaption(text.c_wstr());
}
